import {AddOrderRequestDTO, OrderVO} from "../type/order";
import request from "../utils/http.ts";

/**
 * 获取用户订单
 * @param id
 * */
export function getOrderByIdAPI(id:number) {
    return request<OrderVO>({
        url: `/order/get/${id}`,
        method: 'GET',
    })
}

/**
 * 订单生成
 * @param form
 * */
export function add(form:AddOrderRequestDTO) {
    return request<number>({
        url: '/order/create',
        method: 'post',
        data: form
    })
}

/**
 * 支付订单
 * @param id
 * */
export function payAPI(id:number) {
    return request<OrderVO>({
        url: `/order/update/${id}`,
        method: 'GET',
    })
}

/**
 * 获取订单列表
 * */
export function list() {
    return request<OrderVO[]>({
        url: `/order/list`,
        method: 'GET',
    })
}
